From: Florian Müllner Date: Sat, 26 Apr 2014 19:48:46 +0000 (+0200) Subject: system: Keep key focus when switching between alternatives X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2497 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=011fef4b2b35cbe85e67d157a54ac24022dd3d25;p=gnome-shell.git system: Keep key focus when switching between alternatives When switching between alternatives in AltSwitcher, the currently visible child is replaced with the alternative. If the original child has the key focus when it is removed from the stage, the focus is lost. Detect this case and manually move the focus to the new child. https://bugzilla.gnome.org/show_bug.cgi?id=727259 --- diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 83eb92caf..b36c9d18a 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -56,7 +56,10 @@ const AltSwitcher = new Lang.Class({ } if (this.actor.get_child() != childToShow) { + let hasFocus = this.actor.contains(global.stage.get_key_focus()); this.actor.set_child(childToShow); + if (hasFocus) + childToShow.grab_key_focus(); // The actors might respond to hover, so // sync the pointer to make sure they update.